//package com.ums.upos;
//
//import android.content.ComponentName;
//import android.content.Context;
//import android.content.Intent;
//import android.content.ServiceConnection;
//import android.os.Bundle;
//import android.os.IBinder;
//import android.os.RemoteException;
//import android.support.test.InstrumentationRegistry;
//import android.support.test.espresso.core.deps.guava.util.concurrent.ExecutionError;
//import android.support.test.filters.LargeTest;
//import android.support.test.rule.ServiceTestRule;
//import android.support.test.runner.AndroidJUnit4;
//import android.widget.Toast;
//
//import com.ums.upos.service.DeviceServiceEngineService;
//import com.ums.upos.uapi.device.printer.OnPrintListener.Stub;
//import com.ums.upos.uapi.device.printer.Printer;
//import com.ums.upos.uapi.device.wifiprobe.OnSwitchListener;
//import com.ums.upos.uapi.device.wifiprobe.OnTaskStaListener;
//import com.ums.upos.uapi.device.wifiprobe.WiFiProbeService;
//import com.ums.upos.uapi.engine.DeviceServiceEngine;
//
//import org.json.JSONObject;
//import org.junit.AfterClass;
//import org.junit.Before;
//import org.junit.Rule;
//import org.junit.Test;
//import org.junit.runner.RunWith;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//
///**
// * Created by Administrator on 2017/3/31.
// */
//
//@RunWith(AndroidJUnit4.class)
//@LargeTest
//public class WifiProbeServiceTest {
//    private final static Logger log = LoggerFactory.getLogger("TEST_WIFI_PROBE");
//    //    private static DeviceServiceEngine mDeviceHandle = null;
//    private static WiFiProbeService wiFiProbeService = null;
//    private DeviceServiceEngine mDeviceHandle = null;
//    private OnSwitchListener.Stub onSwitchListener = new OnSwitchListener.Stub() {
//        @Override
//        public void swich(int ret, String msg) throws RemoteException {
//            log.debug("ret:{},msg:{}",ret,msg);
//        }
//    };
//
//    @Rule
//    public ServiceTestRule mServiceRule = new ServiceTestRule();
//
//    @AfterClass
//    public static void afterall() throws InterruptedException {
//        Thread.sleep(3600 * 1000, 0);
//    }
//
//    @Before
//    public void start() {
//        if (null == wiFiProbeService) {
//            ServiceConnection conn = new ServiceConnection() {
//                @Override
//                public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
//                    mDeviceHandle = DeviceServiceEngine.Stub.asInterface(iBinder);
//                }
//
//                @Override
//                public void onServiceDisconnected(ComponentName componentName) {
//                    wiFiProbeService = null;
//                }
//            };
//            Intent intent = new Intent(InstrumentationRegistry.getTargetContext(), DeviceServiceEngineService.class);
//            try {
//                mServiceRule.bindService(intent, conn, Context.BIND_AUTO_CREATE);
//                Bundle loginBundle = new Bundle();
//                loginBundle.putInt("workMode", 0);
//                mDeviceHandle.login(loginBundle, "00000001");
//                wiFiProbeService = mDeviceHandle.getWiFiProbe();
//                Thread.sleep(5 * 1000, 0);
//            } catch (Exception e) {
//                wiFiProbeService = null;
//                e.printStackTrace();
//            }
//        }
//    }
//
//    @Test
//    public void test_WifiProbe() {
//        try {
//            OnTaskStaListener.Stub onTaskStaListener1 = new OnTaskStaListener.Stub() {
//                @Override
//                public void getWiFiProbeOfSta(String probeinfo, String rssi, long time) throws RemoteException {
//                    log.debug("onTaskStaListener1 mac:{},rssi{},time:{}", probeinfo, rssi, time);
//                }
//            };
//            OnTaskStaListener.Stub onTaskStaListener2 = new OnTaskStaListener.Stub() {
//                @Override
//                public void getWiFiProbeOfSta(String probeinfo, String rssi, long time) throws RemoteException {
////                    throw new RemoteException("test");
//                    log.debug("onTaskStaListener2 mac:{},rssi{},time:{}", probeinfo, rssi, time);
//                }
//            };
//            wiFiProbeService.registerStaCallback(onTaskStaListener1);
//            wiFiProbeService.registerStaCallback(onTaskStaListener2);
//            wiFiProbeService.openWifiStaProbe(onSwitchListener);
//            wiFiProbeService.startGetStaProbeInfo();
//            Thread.sleep(5 * 1000, 0);
////            wiFiProbeService.unregisterStaCallback(onTaskStaListener1);
////            Thread.sleep(5 * 1000, 0);
////            wiFiProbeService.unregisterStaCallback(onTaskStaListener2);
////            Thread.sleep(5 * 1000, 0);
////            wiFiProbeService.closeWifiStaProbeInfo(onSwitchListener);
////            Thread.sleep(5 * 1000, 0);
//            wiFiProbeService.closeWifiStaProbe(onSwitchListener);
//            Thread.sleep(10 * 1000, 0);
//        } catch (Exception e) {
//            e.printStackTrace();
//        }
//    }
//
//}
